﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LINQ;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {

            IList<Student> students = new List<Student>();

            students.Add(new Student
            {
                ID = "12345",
                Name = "Bagus",
                Faculty = "Informatics Engineering",
                Major = "Informatics"
            });

            students.Add(new Student
            {
                ID = "12346",
                Name = "Sojo",
                Faculty = "Informatics Engineering",
                Major = "Informatics"
            });

            students.Add(new Student
            {
                ID = "12347",
                Name = "Muhammad",
                Faculty = "Informatics Engineering",
                Major = "Informatics"
            });

            int numbers = students.Count(s => s.Faculty == "Informatics Engineering");

            //IList<Point> points = new List<Point>();
            //points.Add(new Point { X = 1, Y = 2 });
            //points.Add(new Point { X = 1, Y = 3 });
            //points.Add(new Point { X = 1, Y = 4 });
            //points.Add(new Point { X = 2, Y = 2 });
            //points.Add(new Point { X = 2, Y = 3 });

            //var pointsX1 = points.Where(p => p.X == 1 && p.Y == 4);

            //foreach (var point in pointsX1)
            //{
            //    System.Console.WriteLine("Point X={0}, Y={1}", point.X, point.Y);
            //}



            //int[] numbers = new int[7] { 0, 1, 2, 3, 4, 5, 6 };

            //var eventNumbers = numbers.Where(num => evenCheck(num));

            //IList<int> eventNumbers = new List<int>();

            //for (int i = 0; i < numbers.Length; i++)
            //{
            //    if (numbers[i] % 2 == 0)
            //    {
            //        eventNumbers.Add(numbers[i]);
            //    }
            //}

            //foreach (int num in numbers)
            //{
            //    if (num % 2 == 0)
            //    {
            //        eventNumbers.Add(num);
            //    }
            //}

            //var eventNumbers =
            //    from num in numbers
            //    where (num % 2) == 0
            //    select num;


            //foreach (int num in eventNumbers)
            //{
            //    System.Console.Write("{0,1}", num);
            //}
        }

        static Boolean evenCheck(int num)
        {
            return num % 2 == 0;
        }
    }
}
